﻿<a color ='color'><h6><%= t :dsmuonsach%></h6></a>
<%count = 0%>
<%@overdue = Borrowedtable.find(:all, :conditions => ['PayedDate IS NULL'])%>

<%@users    = User.find(:all) %>
<% if(@overdue.count == 0) %>

<h3><%= t :kqmuonsach%></h3>
<%else%>
<font size = '4'> 
<table border="2";> 
  <tr> 
   <th><b><%= t :sott%></b></th>
   <th><b><%= t :nguoidung%></b></th> 
   <th><b><%= t :tensach%></b></th>
   <th><b><%= t :ngaymuon%></b></th>
   <h6><th><%= t :hantrasach%></th></h6>
  </font>   
  </tr>
    <%@users.each do |users|%>
        <%@overover = Borrowedtable.find(:all, :conditions => ['PayedDate IS NULL AND NameOfBorrow = ?',"#{users.firstName+users.lastName}"]) %>
        <%temp = 0%>
        <%@overover.each do |overover|%>
        <%if(temp == 0)%>    
            <tr> 
            <td rowspan = " <%=@overover.count%> "><%=count = count+1%></td> 
            <td rowspan = " <%=@overover.count%> "><%=overover.NameOfBorrow%></td> 
            <td><%=overover.NameOfDrink%></td>
            <td><%=overover.BorrowedDate%></td>
            <td><%=overover.Deadline%></td>  
            </tr> 
            <%temp = temp + 1 %> 
       <%else%>
            <tr> 
            <td><%=overover.NameOfDrink%></td>
            <td><%=overover.BorrowedDate%></td>
            <td><%=overover.Deadline%></td>  
            </tr> 
            <%temp = temp + 1 %> 
    
        <%end%>
       
    <%end%>
    
   <%end%>
<%end%>
</table> 

   



 


